package com.foreknow.dao;

import com.foreknow.bean.Admin;

import java.sql.SQLException;
import java.util.List;

/**
 * 接口中要完成对Admin这个bean的操作
 * 1.添加
 * 2.修改
 * 3.删除
 * 4.查询
 */
public interface AdminDao {
    /**
     * 添加管理员信息
     * sql:insert into admin(username,password,age,school) values(?,?,?,?)
     * @param admin
     * @return
     */
    public boolean save(Admin admin) throws SQLException;

    /**
     * 根据id查询管理员信息
     * sql: select * from admin where id=?
     * @param id
     * @return Admin
     */
    public Admin queryById(Integer id) throws SQLException;

    /**
     * 修改
     * sql:update admin set username=?,password=?,age=?,school=? where id=?
     * @param admin
     * @return boolean
     */
    public boolean update(Admin admin) throws SQLException;

    /**
     * 根据id删除
     * sql: delete from admin where id=?
     * @param id
     * @return boolean
     */
    public boolean delete(Integer id) throws SQLException;

    /**
     * 查询所有的用户信息
     * sql:select * from admin
     * @return List<Object> 集合
     */
    public List<Object> getQueryAll() throws SQLException;

    /**
     * 登录
     * @param username
     * @param password
     * @return
     */
    public Admin isCheckLogin(String username,String password)throws SQLException;
}